<?php

include_once dirname(__FILE__)."/../common/common.php";

/**
* 打卡器接口辅助类
*/
class DakaqiUtil
{


	// 会员注册
	static function registMember($member){

		print_log("--DakaqiUtil ->registMember()  ");

		$url=getConfig("api_member_reg");

		//发送远程请求
		$output=_post_remote($url,$member);
		// $output=_post_remote_curl($url,$member);		

		// 处理返回结果
		$jsoninfo = json_decode($output,true);

		// print_log("---registMember info:".var_dump($jsoninfo));

		return $jsoninfo;


	}
	
	// 报名参加活动
	static function joinActivity($acid,$memberid){

		print_log("--DakaqiUtil->joinActivity()  --acid:".$acid."   memberid:".$memberid);

		$api_join_activity=getConfig("api_join_activity");

		$url=$api_join_activity."?activityId=$acid&memberId=$memberid";

		$result = _get_remote($url);

		print_log("result:".$result);

		$json_data=json_decode($result,true);

		return $json_data;

	}


	// 加入组织
	static function joinOrg($orgid,$memberid){

        print_log("--DakaqiUtil -> joinOrg() orgid:".$orgid."   memberid:".$memberid);

        $api_join_org=getConfig("api_join_org");

        $url=$api_join_org."?orgId=$orgid&memberId=$memberid";

        $result = _get_remote($url);

        print_log("result:".$result);

        $json_data=json_decode($result,true);

        return $json_data;
	}
}


